package com.orhon.smartcampus.modules.systemctl.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "systemctl_apis", schema = "smartcloud", catalog = "")
public class Apis {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", nullable = false)
	private Long id;
	@Column(name = "code", nullable = true, length = 255)
	private String code;
	@Column(name = "name", nullable = true, length = 255)
	private String name;
	@Column(name = "created_at", nullable = true)
	private Date createdAt;
	@Column(name = "updated_at", nullable = true)
	private Date updatedAt;
	@Column(name = "deleted_at", nullable = true)
	private Date deletedAt;
	
	@ManyToOne
    @Where(clause = "ISNULL(deleted_at)")
    @JoinColumn(name = "module_id", referencedColumnName = "id")
    @NotFound(action=NotFoundAction.IGNORE)
    private Modules module;


}
